import Vue from 'vue'
import Vuex from 'vuex'

import createPersistedState from 'vuex-persistedstate' // 数据持久化

Vue.use(Vuex);//vue的插件机制

import user from './modules/user';
const store = new Vuex.Store({
	modules: {
		user
	},
	plugins: [
	// 数据持久化
	createPersistedState({
	  storage: {
		getItem: key => wx.getStorageSync(key),
		setItem: (key, value) => wx.setStorageSync(key, value),
		removeItem: key => () => { }
	  }
	})
	]
})
export default store